<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<h3>这是用户的列表页</h3>
	<h3><a href="<?php echo U('User/add');?>">添加用户</a></h3>
	<table width="500" border="1">
		<tr>
			<th>编号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>性别</th>
			<th>班期</th>
			<th>操作</th>
		</tr>
		<!-- 使用模板引擎的语法进行foreach遍历 
			控制器的assign分配的字符串的名称和name的值一致
			item:是自定义的值，下面使用$vo['username']获取

			$key:固定的字符串，获取的是数组的下标
		-->
		<?php if(is_array($data)): foreach($data as $key=>$vo): ?><tr>
			<td><?php echo ($key); ?>:::<?php echo ($vo['id']); ?></td>
			<td><?php echo ($vo['username']); ?></td>
			<td><?php echo ($vo['age']); ?></td>
			<td><?php echo ($vo['sex']==1 ? '男' : '女'); ?></td>
			<td><?php echo ($vo['classid']); ?></td>
			<td>
				<a href="<?php echo U('User/edit', ['id'=>$vo['id']]);?>">修改</a>
				<a href="<?php echo U('User/delete', ['id'=>$vo['id']]);?>">删除</a>
			</td>
		</tr><?php endforeach; endif; ?>
		<tr>
			<td colspan="6"><?php echo ($show); ?></td>
		</tr>
	</table>
</body>
</html>